﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Web.Services;

namespace ProjectStudy
{
    public partial class DataList控件 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string sql = "select * from Class1";
                DataTable dt = DBAccess.ExecuteDataTable(sql);
                DataList1.DataSource = dt;
                DataList1.DataBind();
            }
        }

        [WebMethod]
        public static string aa(List<string> s)
        {
            string sql = "delete from Class1 where id=@id";
            SqlParameter ps;
            for (int i = 0; i < s.Count; i++)
            {
                ps = new SqlParameter("@id", s[i]);
                DBAccess.ExecuteNonQuery(sql, ps);
            }

            return "批量删除成功";
        }
    }
}